package com.searchdemo.nutch;

import org.apache.nutch.crawl.DbUpdaterJob;
import org.apache.nutch.crawl.GeneratorJob;
import org.apache.nutch.crawl.InjectorJob;
import org.apache.nutch.fetcher.FetcherJob;
import org.apache.nutch.parse.ParserJob;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) {
		GeneratorJob gen = new GeneratorJob();
        String a = null;
        try {
            String[] arg1 = { "/usr/urls", "-crawlId", "xxx" };
            InjectorJob.main(arg1);
            for (int count=0;count<2;count++){
           // String[] arg2 = { "-crawlId", "xxx" };
           // a = gen.gen(arg2);
            a = gen.generate(1, 1, true, true);
            System.out.println("输出的是" + a);
            String[] arg3= {a,"-crawlId","xxx"};
            FetcherJob.main(arg3);
            ParserJob.main(arg3);
            DbUpdaterJob.main(arg3);}
        } catch (Exception e) {
            e.printStackTrace();
        }
	}
}
